<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title></title>
    <link rel="stylesheet" type="text/css" href="../css/aui.css" />
    <link rel="stylesheet" type="text/css" href="../css/style.css" />
    <style type="text/css">
        p {
            margin-bottom: 0.5rem;
        }
        ::-webkit-input-placeholder { /* WebKit browsers */
            color:    #eaeaea;
        }
        :-moz-placeholder { /* Mozilla Firefox 4 to 18 */
            color:    #eaeaea;
        }
        ::-moz-placeholder { /* Mozilla Firefox 19+ */
            color:    #eaeaea;
        }
        :-ms-input-placeholder { /* Internet Explorer 10+ */
            color:    #eaeaea;
        }
    </style>
</head>
<body>
  <div class="myui-from">
    <ul class="myui-from-list">
      <li class="myui-from-list-item">
        <div class="myui-code">
          <input id="jxurl_default" type="text" placeholder="输入可以获取VIP解析的网址" class="myui-from-code-input">
          <button id="btn1" type="button" name="button" style="width:20%;float:left;height: 2.2rem;" class="myui-from-code-button" onclick="getCode()">获取</button>
        </div>
      </li>
    </ul>
	<ul class="myui-from-list" id="viplist">
	
    </ul>	
  </div>
<div style="clear:both">
	<input type='button' onclick="savelist()" style="width:50px;height:30px;line-height:30px;margin:0 auto;float:none;" class="aui-btn aui-btn-info aui-btn-block" id="submit" value="保存"/>
</div>
    <div class="br"></div>
    <div id="vsion" class="user-bt">

    </div>
</body>
<script type="text/javascript" src="../script/api.js" ></script>
<script type="text/javascript" src="../script/common.js" ></script>
<script type="text/javascript">
    apiready = function () {
      api.parseTapmode();
      var appVersion = api.appVersion;
      var vsion = $api.byId('vsion');
      vsion.innerHTML = 'VIP影视 v'+appVersion+' <span style="color:#7bbfea" onclick="mianze()">免责声明</span>  <span style="color:#7bbfea" onclick="help()">帮助声明</span> ';
	  var dataurl = data_url();
	   $api.val($api.byId('jxurl_default'),dataurl);
	  loaddata();
    }
    function mianze(){
        alert('免责声明:本站所有视频均来自互联网，版权归原创者所有，如果侵犯了您的权益，请通知我们，我们将会在3个正常工作日内删除其侵权内容，谢谢合作。')
    }
    function help(){
        openh5('https://gitee.com/web/vip_yingshi')
    }
    function getCode(){
		var dataurl=$api.val($api.byId('jxurl_default'));$api.setStorage('dataurl',dataurl);
		updatelist(1,function(ret){loaddata();})
    }
	function savelist(){
		var viplist  = $api.domAll('.vipapiurl');
		var newlist=[];var defaulturl=''
		for(var i in viplist){
			var val =  $api.val(viplist[i]);
			if(val){
				newlist.push(val);
				if(is_empty(defaulturl))defaulturl=val;
			}
		}
		if(defaulturl)$api.setStorage('jxurl_default',defaulturl);
		if(newlist)$api.setStorage('datalist',newlist);
		alert('保存成功');
	}
	function loaddata(){
      var jxlist=updatelist(0,function(ret){inserthtml(ret);});
	  if(jxlist)inserthtml(jxlist)
	}
    function inserthtml(jxlist){
      var html ='';
	  for(var i in jxlist){
		html+='<li class="myui-from-list-item">'+
        '<input id="text'+i+'" type="text" placeholder="请输入解析网址" value="'+jxlist[i]+'" class="myui-from-list-item-input vipapiurl">'+
		'</li>';
	  }
	  html+='<li class="myui-from-list-item">'+
        '<input id="text" type="text" placeholder="请输入解析网址" value="" class="myui-from-list-item-input vipapiurl">'+
		'</li>';
      var viplistobj = $api.byId('viplist');viplistobj.innerHTML = html;
    }
</script>
</html>
